package com.gkzf.ai.module.crm.dal.mysql.creditReport;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gkzf.ai.framework.common.pojo.PageResult;
import com.gkzf.ai.framework.mybatis.core.mapper.BaseMapperX;
import com.gkzf.ai.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.gkzf.ai.module.crm.controller.admin.creditReport.vo.creditreportbasic.CreditReportBasicPageReqVO;
import com.gkzf.ai.module.crm.dal.dataobject.creditReport.CreditReportBasicDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * CRM 征信报告基础 Mapper
 *
 * @author 国科智飞
 */
@Mapper
public interface CreditReportBasicMapper extends BaseMapperX<CreditReportBasicDO> {

    default PageResult<CreditReportBasicDO> selectPage(CreditReportBasicPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CreditReportBasicDO>()
                .likeIfPresent(CreditReportBasicDO::getName, reqVO.getName())
                .eqIfPresent(CreditReportBasicDO::getDocumentType, reqVO.getDocumentType())
                .eqIfPresent(CreditReportBasicDO::getIdNumber, reqVO.getIdNumber())
                .eqIfPresent(CreditReportBasicDO::getIsSubmitQpCode, reqVO.getIsSubmitQpCode())
                .eqIfPresent(CreditReportBasicDO::getGender, reqVO.getGender())
                .eqIfPresent(CreditReportBasicDO::getIsMatch, reqVO.getIsMatch())
                .eqIfPresent(CreditReportBasicDO::getMarriageStatus, reqVO.getMarriageStatus())
                .eqIfPresent(CreditReportBasicDO::getCreditReportUrl, reqVO.getCreditReportUrl())
                .likeIfPresent(CreditReportBasicDO::getCreditReportName, reqVO.getCreditReportName())
                .eqIfPresent(CreditReportBasicDO::getEducation, reqVO.getEducation())
                .betweenIfPresent(CreditReportBasicDO::getCreateTime, reqVO.getCreateTime())
                .in(CreditReportBasicDO::getCreator, reqVO.getUserList())
                .orderByDesc(CreditReportBasicDO::getId));
    }

    IPage<CreditReportBasicDO> selectCreditReportBasicPage(IPage<CreditReportBasicDO> page, CreditReportBasicPageReqVO reqVO);

}